package com.hx.er.action.admin.settings;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;

import com.hx.er.action.base.ErAdminPageAction;
import com.hx.er.bean.detail.StreetDetailBean;
import com.hx.er.common.util.StringUtil;
import com.hx.er.service.admin.IAdminSettingsService;

public class AdminStreetListAction extends ErAdminPageAction {

	// 序列化ID
	private static final long serialVersionUID = 2487585146579189747L;

	private List<StreetDetailBean> streetDetailList;
	private String localStreetName;
	private long districtId;
	private long cityId;

	@Autowired
	private IAdminSettingsService adminSettingsService;

	public String init() {
		// 检索条件
		Map<String, Object> conditions = super.getConditionMap();
		conditions.put("districtId", this.districtId);
		conditions.put("localStreetName", StringUtil.EmptyToNull(StringUtil.trim(this.localStreetName)));

		// 查询列表
		this.streetDetailList = this.adminSettingsService.getStreetDetailList(conditions);
		int streetCount = this.adminSettingsService.getStreetDetailCount(conditions);
		super.pageCount = (int) Math.ceil(streetCount / (double) super.dataListLimit);

		return SUCCESS;
	}

	public long getDistrictId() {
		return districtId;
	}

	public void setDistrictId(long districtId) {
		this.districtId = districtId;
	}

	public long getCityId() {
		return cityId;
	}

	public void setCityId(long cityId) {
		this.cityId = cityId;
	}

	public String getLocalStreetName() {
		return localStreetName;
	}

	public void setLocalStreetName(String localStreetName) {
		this.localStreetName = localStreetName;
	}

	public List<StreetDetailBean> getStreetDetailList() {
		return streetDetailList;
	}

	public void setStreetDetailList(List<StreetDetailBean> streetDetailList) {
		this.streetDetailList = streetDetailList;
	}

}
